import { WaitShowOrHideTypes } from "../common/enums"
import { WaitTypes } from "../consts/waitType"

export const getStepData = (page, stepTypeCode) => {
    const dataWrapper = {
        setCookie: {
            cookieName: ''
        },
        mock: {
            mockId: '',
            ajaxId: ''
        },
        wait: {
            waitType: WaitTypes.htmlElement.key,
            elementSelectorId: '',
            timeout: 5000,
            waitTo: WaitShowOrHideTypes.Show
        },
        dom: {
            userActionCode: '',
            elementSelectorId: '',
        },
        navigate: {
            url: ''
        },
        stepCollection: {
            stepCollectionId: ''
        },
        assert: {
            assertTypeCode: ''
        }
    }

    if (dataWrapper[stepTypeCode]) {
        return {
            ...dataWrapper[stepTypeCode],
            code: stepTypeCode,
            page,
            readOnly: false
        }
    } else {
        throw `unkown step code: [${stepTypeCode}]`
    }
}